import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hibrid_flutter/bridge/flutter_bridge.dart';
import 'package:hibrid_flutter/finance/finance_page.dart';

class FinanceStatePage extends StatefulWidget {
  const FinanceStatePage({Key? key}) : super(key: key);


  @override
  // ignore: library_private_types_in_public_api
  _FinanceStatePageState createState() => _FinanceStatePageState();
}

class _FinanceStatePageState extends State<FinanceStatePage> {

  @override
  void initState() {
    super.initState();
    FlutterBridge.getInstance().register("onRefresh", (MethodCall call) {
      print('_FinanceStatePageState = ${call.method}'); // 打印 接收native端发来的信息
      // 向native端回信
      return Future.value('flutter 端 已经接收到了信息');
    });
  }

  @override
  void dispose() {
    super.dispose();
    FlutterBridge.getInstance().unRegister("onRefresh");
  }
  @override
  Widget build(BuildContext context) {
    return const FinancePage(params: '投资理财');
  }
}
